<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<script>
		function Parent() {
			this.money = 100000
			this.head = 1
		}

		function Child(name, age) {
			this.name = name
			this.age = age
		}
		//要放在创建实例之前
		// 会造成继承链紊乱
		Child.prototype = new Parent()
		var son = new Child('jiffy', 22)
		// 手动拨正
		Child.prototype.constructor = Child
		alert(Child.prototype.constructor)
		alert(Parent.prototype.constructor)
		alert(son.name)
		alert(son.age)
		alert(son.money)
		alert(son.head)

	</script>
</body>

</html>